<!DOCTYPE html>
<html>
	<head>
		<!--
        	作者：刘开新
        	时间：2018-09-29
        	描述：
        -->
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			#div1{width: 600px;height: 600px;border-style: solid;}
			#div2{width: 300px;height: 300px;border-style: solid;}
			#div3{width: 100px;height: 100px;border-style: solid;}
		</style>
	</head>
	<body>
		
		<div id="div1">
			<div id="div2">
				<div id="div3">
				
				</div>
			</div>
		</div>
		<button onclick="dianji()">点击变色</button>
		<script type="text/javascript">
			var shu=0;
			var color=["#FFEBCD","#00FFFF","#000000","	#54FF9F","	#4EEE94","royalblue","red"];
			function dianji(){
				for (var i=1;i<=3;i++) {
					var div=document.getElementById("div"+i).style.backgroundColor=color[shu];
					shu=shu+1;
					if(shu>6){shu=0;}
				}
				
			}
		</script>
	</body>
</html>
